package cs2340.droidceptiontodo;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Color;

public class Category {
	private static List<Category> categories = new ArrayList<Category>();
	private String name;
	private int color;

	public Category(String name) {
		this.name = name;
		color = Color.LTGRAY;
	}
	
	public void setColor() {
		//TODO determine best way to set color
	}
	/**
	 * toString has the same functionality as getName()
	 * just added this method for conventional purposes
	 * 
	 */
	@Override
	public String toString() {
		return getName();
	}
	public String getName() {
		return name;
	}
	
	public static List<Category> getCategoryList() {
		return categories;
	}
	
	public static void addCategory(String category) {
		if(!isCategory(category))
			categories.add(new Category(category));
	}
	
	public static boolean isCategory(String category)
	{
		boolean isCategory = false;
		for(Category current : categories) {
			if(current.getName().equals(category))
				isCategory = true;
		}
		return isCategory;
	}
	
	public static Category getCategory(String target) {
		Category category = null;
		for(Category current : categories) {
			if(current.getName().equals(target)) {
				category = current;
			}
		}
		return category;
	}
}